package com.mind.core.util;

import java.util.Calendar;

public class TimeUtil {
	public static long getNowSeconds(){
		return System.currentTimeMillis()/1000;
	}
	/**
	 * 毫秒级别的时间戳的时间比较
	 * 
	 * @param oldTime
	 * @param newTime
	 * @return
	 */
    public static boolean isSameDay(long oldTime, long newTime) {
        Calendar oldCalendar = Calendar.getInstance();
        oldCalendar.setTimeInMillis(oldTime);
        
        Calendar newCalendar = Calendar.getInstance();
        newCalendar.setTimeInMillis(newTime);
        
        return oldCalendar.get(Calendar.DAY_OF_YEAR) == newCalendar.get(Calendar.DAY_OF_YEAR);
    }
    
    /**
	 * 给定时间距离现在时间（单位:秒）
	 * 
	 * @param 
	 * @return
	 */
	public static long getBetweenNowSecond(long oldTime) {
		long distance = (System.currentTimeMillis()/ 1000-oldTime) ;
		return distance;
	}
    
}
